/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package kimo.persistence.entities;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author a381u296
 */
@Entity
@Table(name = "pcheck")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Pcheck.findAll", query = "SELECT p FROM Pcheck p"),
    @NamedQuery(name = "Pcheck.findByCheckId", query = "SELECT p FROM Pcheck p WHERE p.checkId = :checkId"),
    @NamedQuery(name = "Pcheck.findByCheckDate", query = "SELECT p FROM Pcheck p WHERE p.checkDate = :checkDate"),
    @NamedQuery(name = "Pcheck.findByCheckDescr", query = "SELECT p FROM Pcheck p WHERE p.checkDescr = :checkDescr"),
    @NamedQuery(name = "Pcheck.findByCheckResult", query = "SELECT p FROM Pcheck p WHERE p.checkResult = :checkResult"),
    @NamedQuery(name = "Pcheck.findByCheckPenalty", query = "SELECT p FROM Pcheck p WHERE p.checkPenalty = :checkPenalty")})
public class Pcheck implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "check_id")
    private Integer checkId;
    @Column(name = "check_date")
    @Temporal(TemporalType.TIMESTAMP)
    private Date checkDate;
    @Column(name = "check_descr")
    private String checkDescr;
    @Column(name = "check_result")
    private String checkResult;
    @Column(name = "check_penalty")
    private String checkPenalty;
    @JoinColumn(name = "check_user_id", referencedColumnName = "user_id")
    @ManyToOne
    private User checkUserId;
    @JoinColumn(name = "check_producer_id", referencedColumnName = "producer_id")
    @ManyToOne(optional = false)
    private Producer checkProducerId;

    public Pcheck() {
    }

    public Pcheck(Integer checkId) {
        this.checkId = checkId;
    }

    public Integer getCheckId() {
        return checkId;
    }

    public void setCheckId(Integer checkId) {
        this.checkId = checkId;
    }

    public Date getCheckDate() {
        return checkDate;
    }

    public void setCheckDate(Date checkDate) {
        this.checkDate = checkDate;
    }

    public String getCheckDescr() {
        return checkDescr;
    }

    public void setCheckDescr(String checkDescr) {
        this.checkDescr = checkDescr;
    }

    public String getCheckResult() {
        return checkResult;
    }

    public void setCheckResult(String checkResult) {
        this.checkResult = checkResult;
    }

    public String getCheckPenalty() {
        return checkPenalty;
    }

    public void setCheckPenalty(String checkPenalty) {
        this.checkPenalty = checkPenalty;
    }

    public User getCheckUserId() {
        return checkUserId;
    }

    public void setCheckUserId(User checkUserId) {
        this.checkUserId = checkUserId;
    }

    public Producer getCheckProducerId() {
        return checkProducerId;
    }

    public void setCheckProducerId(Producer checkProducerId) {
        this.checkProducerId = checkProducerId;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (checkId != null ? checkId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Pcheck)) {
            return false;
        }
        Pcheck other = (Pcheck) object;
        if ((this.checkId == null && other.checkId != null) || (this.checkId != null && !this.checkId.equals(other.checkId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "kimo.persistence.entities.Pcheck[ checkId=" + checkId + " ]";
    }
    
}
